package com.example.demo.config;

import com.example.demo.entity.Person;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 项目中有改类，才会生成下面的bean
 * https://blog.csdn.net/lbh199466/article/details/102682084
 */
@Configuration
@ConditionalOnClass(name = "org.springframework.kafka.core.KafkaTemplate")
public class ConditionalOnClassLearn {
    @Bean(name = "person-dddd")
    public Person getPerson() {
        return new Person("", 22);
    }
}
